home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / EleOfC++ vrs 0.1 / TextEdit / TDoc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-14  |  2.7 KB  |  109 lines  |  [TEXT/KAHL]

  1. /*
  2. ** This is the TDoc class declaration.  This class is an adaptation of 
  3. ** the class of the same name in the book, Elements of C++ Macintosh 
  4. ** Programming, by Dan Weston.
  5. **
  6. ** Copyright © 1991 Mark Gross 
  7. ** (RR2, Box 84, Clayville, NY 13322);         
  8. ** this file may be published everywhere, but no charge
  9. ** may be made for its use.  Please contact me about any bugs found.
  10. ** I'm also looking for Macintosh development work, so drop me a line
  11. ** if you think I could help.  
  12. **    
  13. */
  14.  
  15. #define _H_TDoc
  16.  
  17.  
  18. struct    TDoc:indirect
  19. {
  20.     OSType        fCreator;
  21.     SFReply        fFileInfo;
  22.     Boolean        fFileOpen;
  23.     short        fRefNum;
  24.     WindowPtr    fDocWindow;
  25.     Boolean        fNeedtoSave;
  26.     Boolean        fNeedtoSaveAs;
  27. /* 
  28. ** Other data holding members will need to be added as needed in 
  29. ** any derived classes from this one.
  30. */
  31.  
  32. /*    constuctor and destructor        */
  33.     TDoc*        Init(OSType theCreator, SFReply *SFInfor);
  34.     void        Delete(void);
  35.  
  36. /*    initializing documents        */    
  37.     Boolean        MakeWindow(Boolean colorWindow);
  38.     short        GetWinID(void);
  39.     Boolean        InitDoc(void);
  40.  
  41. /*    maintaining windows        */
  42.     WindowPtr    GetDocWindow(void);
  43.     void        SetDocWindowTitle(Str255 title);
  44.     void        MoveDocWindow(short h, short v);
  45.     void        ShowDocWindow(void);
  46.  
  47. /*    handling events        */    
  48.     void        DoTheUpdate(EventRecord *TheEvent);
  49.     void        Draw(Rect *r);
  50.     
  51.     void        DoActivate(EventRecord *TheEvent);
  52.     void        Activate(void);
  53.     void        Deactivate(void);
  54.     
  55.     void        DoGrow(EventRecord *theEvent);
  56.     void        DoZoom(short partCode);
  57.     void        DoDrag(EventRecord *theEvent);
  58.     
  59.     void        DoContent(EventRecord *theEvent);
  60.     void        DoKeyDown(EventRecord *theEvent);
  61.     
  62.     void        DoIdle(void);
  63.     void        AdjustCursor(Point where);
  64.  
  65. /*    handling menus        */    
  66.     void        SetMenuAbility(MenuHandle menu, short item, Boolean enable);
  67.     void        AdjustDocMenus(void);
  68.     
  69.     Boolean     CanUndo(void);
  70.     Boolean        CanSave(void);
  71.     Boolean        CanClose(void);
  72.     Boolean        CanPaste(OSType);
  73.     Boolean        CanSaveAs(void);
  74.     Boolean        CanPageSetup(void);
  75.     Boolean        CanPrint(void);
  76.     Boolean        HaveSelection(void);
  77.     Boolean        CanSelectAll(void);
  78.     
  79.     Boolean        DoDocMenuCommand(short menuID, short menuItem);
  80.  
  81. /*    cut, copy, and paste        */    
  82.     Boolean        DoCut(Handle *theData, OSType *heType);
  83.     Boolean        DoCopy(Handle *theData, OSType *theType);
  84.     void        DoPaste(Handle theData, OSType *theType);
  85.     void        DoUndo(void);
  86.     void        DoClear(void);
  87.     void        DoSelectAll(void);
  88.     
  89. /*    handling files            */
  90.     short        OpenDocFile(SFReply *reply);
  91.     void        CloseDocFile(short refNum);
  92.     
  93.     Boolean        ReadDocFile(short refNum);
  94.     Boolean        WriteDocFile(short refNum);
  95.         
  96.     Boolean        DoSaveAs(void);
  97.     Boolean        DoSave(void);
  98.     short        WantToSave(void);
  99.     Boolean        DoClose(void);
  100.  
  101.     OSType        GetDocType(void);
  102.  
  103.     void        DoPageSetup(void);
  104.     void        DoPrint(void);
  105.     
  106.     
  107.         
  108.     void        ErrorAlert(short stringsID, short theError);
  109. };